﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using NHibernate;
using NHibernate.Criterion;
using System.Web.UI.WebControls;
using NHibernate.Linq;
using mscook.core.domain;
using System.Linq.Expressions;
namespace mscook.core.repositories
{
    public class LoginUserOfVipRepository:Repository<LoginUserOfVip>, mscook.core.repositories.ILoginUserOfVipRepository
    {
        public IList<LoginUserOfVip> SelectLimitByOrder(int start, int limit, out long total, Expression<Func<LoginUserOfVip, bool>> select_expression)
        {
            var q = (from x in this.Session.Query<LoginUserOfVip>() select x)
                .Where(o => o.IsDelete == false).Where(select_expression).OrderBy(o=>o.IsPassed).OrderByDescending(o=>o.CreateTime);
            total = q.Count();
            return q.Skip(start).Take(limit).ToList();
        }



    }
}
